#ifndef XDIVA_ABSTRACTSHAPE_ITEM_H
#define XDIVA_ABSTRACTSHAPE_ITEM_H

#include "Item.h"
#include <QAbstractGraphicsShapeItem>
#include <string>

class AbstractManager;
class NodeInPort;
class NodeOutPort;
class xMappingNode;
class QGraphicsItem;
class QPen;

class AbstractShapeItem: public Item, public QAbstractGraphicsShapeItem  {
public:

	const static int MAPPING_NODE  = 0;
	const static int ENTRY_NODE    = 1;
	const static int ENTRY_NODE_FRAME = 2;
	const static int GATE_NODE = 3;

	AbstractShapeItem( std::string , AbstractManager*, QGraphicsItem *parent = 0 );
	virtual ~AbstractShapeItem();

	virtual NodeInPort* addInPort();
	virtual NodeOutPort* addOutPort();
	virtual void deleteInPort( NodeInPort* );
	virtual void deleteOutPort( NodeOutPort* );

	xMappingNode* getMappingNode() const;
	std::string getName() const;
	const std::vector< NodeInPort * > & getInportList() const;
	const std::vector< NodeOutPort * > & getOutportList() const;
	void deleteEmptyInPort();
	void deleteEmptyOutPort();
	int height();
	int width();
	int nodeType();
	void setBackgroundColor( const QColor &);
	void setFontColor( const QColor & );
	void setForeachElements(bool);
	bool isForeachElements() const;

protected:
	std::string _name;
	xMappingNode* _mpnNode;
	std::vector<NodeInPort*> _inportList;
	std::vector<NodeOutPort*> _outportList;
	int _bodyHeight;
	int _width;
	QPen *_fontColor;
	QBrush *_backgroundColor;
	int _nodeType;
	virtual void setupPort() = 0;
	void setBodyHeight(int);

};

#endif
